<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" th:with="title='Management',active='home'">
<header th:replace="admin/fragments/header::headerFragment(${title},${active})"></header>

<body class="fixed-left">
    <div id="wrapper">
        <div th:replace="admin/fragments/header::header-body"></div>
        <div class="content-page">
            <div class="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12">
                            <h4 class="page-title">Dashboard</h4>
                        </div>

                        <div class="row">
                            <div class="col-sm-6 col-lg-3">
                                <div class="mini-stat clearfix bx-shadow bg-info">
                                    <span class="mini-stat-icon"><i class="fa fa-quote-right"
                                            aria-hidden="true"></i></span>
                                    <div class="mini-stat-info text-right">
                                        Posted<span class="counter" th:text="${statistics.articles}"></span>Blogs
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 col-lg-3">
                                <div class="mini-stat clearfix bg-purple bx-shadow">
                                    <span class="mini-stat-icon"><i class="fa fa-comments-o"
                                            aria-hidden="true"></i></span>
                                    <div class="mini-stat-info text-right">
                                        Got<span class="counter" th:text="${statistics.comments}"></span>Comments
                                    </div>
                                </div>
                            </div>

                            <div class="col-sm-6 col-lg-3">
                                <div class="mini-stat clearfix bg-success bx-shadow">
                                    <span class="mini-stat-icon">
                                        <i class="fa fa-cloud-upload" baria-hidden="true"></i>
                                    </span>
                                    <div class="mini-stat-info text-right">
                                        Uploaded<span class="counter" th:text="${statistics.attachs}"></span>Attachments
                                    </div>
                                </div>
                            </div>

                            <div class="col-sm-6 col-lg-3">
                                <div class="mini-stat clearfix bg-primary bx-shadow">
                                    <span class="mini-stat-icon"><i class="fa fa-link" aria-hidden="true"></i></span>
                                    <div class="mini-stat-info text-right">
                                        Linked<span class="counter" th:text="${statistics.links}"></span>Friends
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-4">
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        <h4 class="panel-title">The newest blog</h4>
                                    </div>
                                    <div class="panel-body">
                                        <ul class="list-group">
                                            <li class="list-group-item" th:each="article : ${articles}">
                                                <span class="badge badge-primary"
                                                    th:title="${article.commentsNum}+' Comments'"
                                                    th:text="${article.commentsNum}"></span>
                                                <a target="_blank"
                                                    th:href="${commons.site_url('/detail/')}+${article.cid}"
                                                    th:text="${commons.subStr(article.title,12)}"></a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        <h4 class="panel-title">The newest comment</h4>
                                    </div>
                                    <div class="panel-body">
                                        <div th:if="${comments}== null and ${#lists.size(comments)}==0">
                                            <div class="alert alert-warning">
                                                No comment received.
                                            </div>
                                        </div>
                                        <ul class="list-group"
                                            th:unless="${comments}==null and ${#lists.size(comments)}==0">
                                            <li class="list-group-item" th:each="comment : ${comments}">
                                                <div th:if="${comment.url}!=null and ${comment.url}!=''">
                                                    <a th:href="@{${comment.url}}" target="_blank"
                                                        th:text="${comment.author}"></a>
                                                    <th:block th:unless="${comment.url}!=null and ${comment.url}!=''"
                                                        th:text="${comment.author}" />
                                                    At
                                                    <th:block
                                                        th:text="${commons.fmtdate(comment.created,'MMM.ddD.HH:mm')}" />
                                                    :
                                                </div>
                                                <a th:href="${commons.site_url('/detail/')}+${comment.cid}+'#comments-content'"
                                                    target="_blank" th:utext="${commons.article(comment.content)}"></a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="panel panel-default">
                                    <div class="panel-heading">
                                        <h4 class="panel-title">System Log</h4>
                                    </div>
                                    <div class="panel-body">
                                        <ul class="list-group">
                                            <li class="list-group-item" th:each="log : ${logs}">
                                                <span
                                                    th:text="${commons.fmtdate(log.created, 'yyyy-MM-dd HH:mm:ss')} +' => '+ ${log.action}"></span>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div th:replace="admin/fragments/footer :: footer-content"></div>
                </div>
            </div>
        </div>
    </div>
    <div th:replace="admin/fragments/footer :: footer"></div>
</body>

</html>